package com.clkj.goldpartner.dao;

import com.clkj.goldpartner.pojo.Shop;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

/**
 * @author 杨行
 * @date 2021/3/23 13:46
 */
@Repository
public interface ShopMapper extends Mapper<Shop> {
    /**
     * 关闭门店
     *
     * @param shop_id
     */
    @Update("update t_cl_shop set shop_status = '0' where shop_id = #{shop_id}")
    void updateShop(Integer shop_id);

    /**
     * 获取门店列表
     *
     * @return
     */
    @Select("select * from t_cl_shop where shop_id != '-15114561' and shop_status = '1' and parent_id = 0 ")
    List<Shop> getShop();

    /**
     * 获取门店列表
     *
     * @return
     */
    @Select("select * from t_cl_shop where shop_id != '-15114561' and shop_status = '1' ")
    List<Shop> getShopAndChildren();

    /**
     * 从账号获取人员
     *
     * @param shop_account
     * @return
     */
    @Select("select * from t_cl_shop where shop_account = #{shop_account}")
    Shop getShopByAccount(String shop_account);
}
